package com.xxl.job.executor.sample.frameless.test.MongoDB;

import com.mongodb.MongoClient;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import org.bson.Document;

import java.util.ArrayList;

public class MongoDB2 {
    public static void main(String[] args) {
        //1、MongoDB连接
        MongoClient mongoClient = new MongoClient("127.0.0.1",27017);
        //2、获取一个数据库，不存在会自动创建
        MongoDatabase mongoDatabase = mongoClient.getDatabase("java");
        //3、获取集合，不存在会自动创建
        MongoCollection<Document> java_collection = mongoDatabase.getCollection("java_collection");
        
    }
}
